package ru.spb.osll.myfit.wikiverifier.result;

import java.util.LinkedList;
import java.util.List;

public class PageVerificationResult {
	private VerificationResultType m_result;
	private List<TableVerificationResult> m_tableResults;

	public PageVerificationResult() {
		m_result = VerificationResultType.OK;
		m_tableResults = new LinkedList<TableVerificationResult>();
	}

	public void addTableResult(TableVerificationResult tableRes) {
		m_tableResults.add(tableRes);
		if (tableRes.getResult() == VerificationResultType.ERROR) {
			m_result = VerificationResultType.ERROR;
		} else if (tableRes.getResult() == VerificationResultType.FAILURE
				&& m_result != VerificationResultType.ERROR) {
			m_result = VerificationResultType.FAILURE;
		}
	}

	public VerificationResultType getResult() {
		return m_result;
	}

	public List<TableVerificationResult> getTableResults() {
		return m_tableResults;
	}

}
